package me.tonywang.common.util;

import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.support.PropertiesLoaderUtils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @className: PropertiesUtils
 * @description:
 * @author: WANGHUI
 * @createDate: 2018/5/11 9:55
 * @version: 1.0
 */
public abstract class PropertiesUtils extends PropertiesLoaderUtils {

    public static Properties load(String propertiesFile) {
        Properties prop = new Properties();
        try {
            InputStream in = new DefaultResourceLoader().getResource(propertiesFile).getInputStream();
            prop.load(in);
        } catch (IOException e) {
            return null;
        }
        return prop;
    }

}
